package kr.co.hk;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;

public class AlertDialogList extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        final CharSequence[] items = {"Red","Green","Blue"};
        
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Pick a color")
               .setItems(items, new OnClickListener() {				
				@Override
				public void onClick(DialogInterface dialog, int item) {
					Toast.makeText(getApplicationContext(), items[item],
							Toast.LENGTH_SHORT).show();					
				}
			});
        AlertDialog alert = builder.create();
        alert.show();
        
    }
}